package cn.itcast.user;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

/**
 * 用户微服务启动类--b1分支
 */

@SpringBootApplication
@EnableFeignClients //启用Feign客户端，可以基于Feign（或者ribbon）远程调用其他微服务
@EnableEurekaClient //启用Eureka客户端，可以将当前应用注册到Eureka Server中，此注解可以省略
@EnableDiscoveryClient //启用服务发现，表示可以从Eureka Server中查找微服务
public class UserApplication {
    @Bean //通过Bean注解可以将当前对象交由spring容器管理
    @LoadBalanced //启用负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(UserApplication.class);
    }
}